﻿using MyWpfFramework.Models;
using MyWpfFramework.Pages;
using MyWpfFramework.UserControls;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace MyWpfFramework
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            List<SubItem>? menuRegister = new List<SubItem>();
            menuRegister.Add(new SubItem("wpf控件", new uc_page(), "/Resources/board.png"));
            menuRegister.Add(new SubItem("wpf控件2", new GridViewPage(), "/Resources/overview.png"));
            menuRegister.Add(new SubItem("模版使用", new UC_Template()));
            ItemMenu? item1 = new ItemMenu("菜单", menuRegister);
            Menu.Children.Add(new UC_MenuItem(item1, this));

        }
        public void SwitchScreen(object sender)
        {
            var screen = ((UserControl)sender);

            if (screen != null)
            {
                StackPanelMain.Children.Clear();
                StackPanelMain.Children.Add(screen);
            }
        }

        private void Image_MouseEnter(object sender, MouseButtonEventArgs e)
        {
            Process.GetCurrentProcess().Kill();
        }

        private void CanvasContainer_OnDragMove(object sender, MouseButtonEventArgs e)
        {
            switch (e.ClickCount)
            {
                case 1:
                    this.DragMove();
                    break;
            }
        }
    }
}
